<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<view class="back iconfont icon-xiangzuo1" @tap="backPage"></view>
			<view class="text" :class="scrrol == true ? 'scrrolHeader' : ''">{{title}}</view>
		</view>	
		<view class="clear_box"></view>
		<view v-if="stype == 2">
			<view class="time_2">报告时间：{{report_time}}</view>
			<view class="time_2">车架号：{{vin}}</view>
			<view class="goods" v-if="result != '' && result != 'undefined'">
				<view class="top">
					<view class="hao">改表分析：
					<view class="gong">{{result.desc}}</view>
					</view>
				</view>
			</view>
			<block v-for="(item, idx) in report_order_1" :key="index">
				<view class="goods">
					<view class="top">
						<view class="hao">里程数：{{ item.mileage }}</view>
						<view class="hao">时间：{{item.reportTime}}</view>
						
					</view>
				</view>
			</block>
			<block v-for="(item, idx) in report_order_2" :key="index">
				<view class="goods">
					<view class="top">
						<view class="hao">里程数：{{ item.mileage }}</view>
						<view class="hao">时间：{{item.reportTime}}</view>
						
					</view>
				</view>
			</block>
		</view>
		<view v-if="stype == 0"> 
			<view class="time_2">车架号：{{vin}}</view>
			<block v-for="(item, idx) in report_order_3" :key="index">
				<view class="goods">
					<view class="hao">里程数：{{item.factoryMileage}}</view>
					<view class="hao">时间：{{item.preDeliveryTime}}</view>
					<view class="hao">维修原因：{{item.repairType}}</view>
					<view class="content">
						维修项目列表:
						<view class="left">
							<block v-for="(item_l, idx) in item.repairItemList" :key="index_l">
							<view class="zuob">
								<view class="money">{{item_l.itemName}}；</view>
							</view>
							</block>
						</view>
					</view>
					<view class="content">
						维修材料清单:
						<view class="left">
							<block v-for="(item_m, idx) in item.repairMaterialList" :key="index_m">
							<view class="zuob">
								<view class="money">{{item_m.componentName}}；</view>
							</view>
							</block>
						</view>
					</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				scrrol:false,
				list:[],
				title : '出险报告',
				empty_show:0,
				stype:'',
				report_order_1:[],
				report_order_2:[],
				result:'',
				report_time:'',
				vin:'',
				report_order_3:[],
			}
		},
		onLoad(opt) {
			let that = this;
			let order = uni.getStorageSync('report_order0');
			that.order = order;
			that.stype = order.stype;
			that.vin = order.vin;
			if (order.stype == 0){
				that.title = '维保报告';
			}
			if (order.stype == 6){
				that.title = '综合报告';
			}
			if (order.stype == 2){
				that.title = '里程报告';
			}
			if (order.stype == 7){
				that.title = '电池报告';
			}
			let report_order = order.req_data; // JSON.parse(order.rep_text);
			if (order.stype == 2){
				that.report_order_1 = report_order.result.report.noiseMileageEntities;
				that.report_order_2 = report_order.result.report.otherMileageEntities;
				that.result = report_order.result.report.mileResult;
				that.report_time = report_order.result.report_time;
			}
			if (order.stype == 0){
				that.report_order_3 = report_order.data.report_txt;
				console.log(that.report_order_3);
			}
		},
		onShow() {
			let that = this;
			let order_list = uni.getStorageSync('order_list');
			if (order_list){
				that.page = 1;
				that.loadData();
				uni.removeStorageSync('order_list');
			}
		},
		methods: {
			loadData() {
				let that = this;
				let params = {
					stype : that.stype,
					status : that.select,
					keyword : that.search_key,
					page : that.page
				}
				that.Net._get('auth/order/car_order_list', params, res => {
					if (res.code == 1) {
						that.list = res.data;
						if (that.list.length == 0){
							that.empty_show = 1;
						}else{
							that.empty_show = 0;
						}
					}else{
						that.empty_show = 1;
					}
				});
			},
			backPage() {
				uni.navigateBack({});
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},
			
		},
		onPageScroll: function(Object) {
			//console.log(Object.scrollTop); //实时获取到滚动的值
			if (Object.scrollTop > 28) {
				this.scrrol = true;
				/* #ifdef APP-PLUS */
				/* #endif */
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
				/* #ifdef APP-PLUS */
				/* #endif */
			}
		},
		onReachBottom() {
			var that = this;
		},
	}
</script>

<style>
	.header{
		background-color: transparent !important;
		height: 20vw !important;
	}
	
	.header .text{
		background-color: transparent !important;
		color: #333 !important;
	}
	
	.header .back{
		color: #333 !important;
	}
	
	.scrrolHeader{
		background-color: #F9E9E3 !important;
	}
	
	.scrrolHeader02{
		background-color: #F9E9E3 !important;
	}
	
	.clear_box02{
		height: 13.5vw !important;
	}
	
	.menucolor {
		color: #091624 !important;
		font-weight: bold;
		font-size: 4.7vw !important;
	}
	
	.menucolor02 {
		display: block !important;
	}
	
	.menucolor03 {
		background-color: #FF9822 !important;
	}
	
	.goods{
		width: calc(98% - 3vw);
		padding: 3vw;
		background-color: #fff;
		margin:3vw auto 0vw;
		border-radius: 2vw;
	}
	.top{
		display: flex;
		justify-content: space-between;
		width: 100%;
		align-items: center;
		border-bottom: 1px solid #f7f7f8;
		padding-bottom: 2vw;
	}
	.hao{
		color: #333;
		font-size: 3.5vw;
	}
	.gong{
		color: #e6201f;
		font-size: 3.5vw;
		font-weight: bold;
	}
	.content{
		display: flex;
		margin-top: 2vw;
	}
	
	.tup{
		width: 25vw;
		height: 18vw;
	}
	.tup image{
		width: 100%;
		height: 100%;
		border-radius: 2vw;
	} 
	.left{
		width: calc(100% - 27vw);
		margin-left: 2vw;
	}
	.jia{
		color: #333;
		font-weight: bold;
		font-size: 3.5vw;
	}
	.time{
		color: #999;
		font-size: 3.5vw;
		margin-top: 1vw;
	}
	
	.time_2{
		font-size: 3.5vw;
		margin: 3vw 4vw 0vw;
	}
	.money{
		/* color: #e6201f; */
		font-size: 3.3vw;
	}
</style>
